Repository navigation
Send the intent source in a single track visit - #847
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Deferred visits consume launch attribution before callbacks are available, and background cancellation discards it, so the first delivered visit can incorrectly be reported as DIRECT instead of retaining push or link attribution.
1 open issue
What changed in this PR
This PR updates the SDK’s visit tracking so a push or link intent supplies attribution to one visit, while subsequent visits use DIRECT until a new intent arrives.
Changes:
- Replace the intent-change flag with an
AtomicBooleanand consume it when reading the visit source. - Add regression tests for reinitialization and foreground transitions after push/link launches.
| File | Description |
|---|---|
| sdk/src/test/java/cloud/mindbox/mobile_sdk/managers/LifecycleManagerTest.kt | Tests single-use attribution and removal of link URLs from later visits. |
| sdk/src/main/java/cloud/mindbox/mobile_sdk/managers/LifecycleManager.kt | Adds atomic source consumption for immediate and pending visits. |
Review effort: Balanced
| sameActivity: Boolean = true, | ||
| ): Unit = loggingRunCatching { | ||
| val source = if (intentChanged) intentSource(intent) else DIRECT | ||
| val source = takeIntentSource(intent) |
Collaborator
Author
There was a problem hiding this comment.
Ожидаемое поведение. Не будем чинить
sergeysozinov
approved these changes
Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Проблема
После запуска приложения по пушу или ссылке следующие track visit по тому же intent повторяли его источник: повторный
Mindbox.initи возврат из фона отправлялиpushилиlinkс тем же URL вместоdirect. ФлагintentChangedвыставлялся при получении intent и не сбрасывался после отправки визита.Решение
Флаг сбрасывается в момент чтения источника (
takeIntentSource), поэтому источник intent попадает ровно в один визит. Все следующие визиты уходят какdirect, пока не придёт новый intent. Флаг сталAtomicBoolean, чтобы чтение и сброс были одной операцией.